# Copyright (c) Meta Platforms, Inc. and affiliates.

load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")
load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary")
load("../../defs.bzl", "zs_fuzzers")

oncall("data_compression")

cpp_unittest(
    # @autodeps-skip
    name = "test_zstrong_cpp",
    srcs = ["test_zstrong_cpp.cpp"],
    deps = [
        "..:zstrong_json",
    ],
)

cpp_unittest(
    # @autodeps-skip
    name = "test_zstrong_json",
    srcs = ["test_zstrong_json.cpp"],
    deps = [
        "..:zstrong_json",  # @manual
        "//folly:file_util",
        "//folly:memory",
        "//folly/testing:test_util",
    ],
)

cpp_unittest(
    # @autodeps-skip
    name = "test_zstrong_ml",
    srcs = ["test_zstrong_ml.cpp"],
    headers = ["test_zstrong_ml_models.h"],
    deps = [
        "..:zstrong_ml",  # @manual
        "../..:zstronglib",  # @manual
        "//folly:base64",
        "//folly:dynamic",
    ],
)

python_binary(
    name = "test_zstrong_ml_models_generator",
    main_function = ".test_zstrong_ml_models_generator.main",
    main_src = "test_zstrong_ml_models_generator.py",
    deps = [
        "../py:zstrong_ml",
        "fbsource//third-party/pypi/click:click",
        "fbsource//third-party/pypi/numpy:numpy",
        "fbsource//third-party/pypi/pandas:pandas",
        "fbsource//third-party/pypi/xgboost:xgboost",
    ],
)

zs_fuzzers(
    srcs = [
        "fuzz_zstrong_ml.cpp",
    ],
    headers = [
        "test_zstrong_ml_models.h",
    ],
    ftest_names = [
        ("MLTest", "FuzzGBTPredictorConfiguration"),
        ("MLTest", "FuzzGBTPredictorPredict"),
        ("MLTest", "FuzzFeatureGeneatros_IntFeaturesGenerator"),
        ("MLTest", "FuzzFeatureGeneatros_DeltaIntFeaturesGenerator"),
        ("MLTest", "FuzzFeatureGeneatros_TokenizeIntFeaturesGenerator"),
    ],
    deps = [
        "..:zstrong_ml",
        "../../tests:fuzz_utils",
        "../gbt_predictor:zstrong_gbt_predictor",
        "fbsource//xplat/security/lionhead/utils/lib_ftest:lib",
    ],
)
